/*
 * @Date: 2020-08-27 16:02:33
 */
import React, { useState, useEffect, useMemo } from 'react';
import useTimeStatus from './hook/useTimeStatus';
function Example() {
  const [count, setCount] = useState(0);
  const { times } = useTimeStatus() // 时钟
  useEffect(() => {
    // 使用浏览器的 API 更新页面标题
    document.title = `You clicked ${count} times`;
  }, [count]);

  const mn = useMemo(() => {
    return count * 2
  }, [count])
  return (
    <div>
      <p>You clicked {count} times</p>
      <p>{times.toLocaleTimeString()}</p>
      <button onClick={() => setCount(count + 1)}>
        Click me {mn}
      </button>
    </div>
  );
}
export default Example